package org.tech4j.captcha.api.model;

import java.util.concurrent.TimeUnit;
import java.util.function.Function;
import java.util.function.Supplier;

/**
 * @program: tech4j
 * @description:
 * @author: YuKai Fan
 * @create: 2025/3/4 11:37
 **/
public interface CaptchaEntity {

    /**
     * 验证码key
     * @return
     */
    String getKey();

    /**
     * 存储方式
     * @return
     */
    String getStoreType();

    /**
     * 过期时间 (秒)
     * @return
     */
    Long getExpireAt();

    default TimeUnit getTimeUnit() {
        return TimeUnit.SECONDS;
    }

    /**
     * 生成验证码
     * @return
     */
     default <T> Supplier<T> getCaptcha() {
         return () -> null;
     }

    /**
     * 验证码发送 function
     * @return
     */
    default Function<CaptchaEntity, CaptchaResponse> getSendFunction() {
        return null;
    }
}
